package cate.game.common.rpc;

import cp.solution.business.game.conf.GameSrvEntity;
import cp.solution.rpc.RpcMsgHead;

import java.util.HashSet;
import java.util.Set;

public abstract class RpcListener4Game extends RpcListenerTemplate {

    private static Set<String> regPaths = new HashSet<>();
    public static void regPath(String path) {
        regPaths.add(path);
    }
    public static boolean awarePath(String path) {
        return regPaths.contains(path);
    }

    protected GameSrvEntity config;

    public RpcListener4Game(GameSrvEntity config) {
        this.config = config;
    }

    protected int curSrvId() {
        return this.config.getId();
    }

    protected String curCrossCode() {
        return this.config.getCrossCode();
    }

    protected String curGroupCode() {
        return this.config.getGroupCode();
    }

    /** 是否接纳这条消息 */
    public abstract boolean accept(RpcMsgHead head);

}
